#include "myfinddialog.h"
#include "ui_myfinddialog.h"

MyFindDialog::MyFindDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::MyFindDialog)
{
    ui->setupUi(this);

    //关联取消按钮与对话框关闭
    connect(ui->cancel, &QPushButton::clicked, this, &MyFindDialog::reject);
}

MyFindDialog::MyFindDialog(const QString &text, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::MyFindDialog)
{
    ui->setupUi(this);

    //设置默认查找内容
    ui->edit_find->setText(text);

    //关联取消按钮与对话框关闭
    connect(ui->cancel, &QPushButton::clicked, this, &MyFindDialog::reject);
}

void MyFindDialog::on_find_next_clicked()
{
    emit find_next_clicked(ui->edit_find->text());
}

void MyFindDialog::on_find_all_clicked()
{
    emit find_all_clicked(ui->edit_find->text());
}

MyFindDialog::~MyFindDialog()
{
    delete ui;
}
